package com.bw.shop_2302.adapter

import android.graphics.Color
import android.widget.TextView
import com.bw.base.entity.ExplosiveMoney
import com.bw.shop_2302.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class MoneyAdapter:BaseQuickAdapter<ExplosiveMoney,BaseViewHolder>(R.layout.item_money) {

    var selecttyp=4//默认选中分类的值为4

    override fun convert(holder: BaseViewHolder, item: ExplosiveMoney) {
        holder.setText(R.id.tv_money_info,item.info)
        holder.setText(R.id.tv_money_name,item.name)


        if(selecttyp==item.type.toInt()){
            holder.getView<TextView>(R.id.tv_money_info).setTextColor(Color.RED)
            holder.getView<TextView>(R.id.tv_money_name).setTextColor(Color.RED)
        }else{
            holder.getView<TextView>(R.id.tv_money_info).setTextColor(Color.BLACK)
            holder.getView<TextView>(R.id.tv_money_name).setTextColor(Color.BLACK)
        }


    }

    fun updatetype(type:Int){
        selecttyp=type
        notifyDataSetChanged()
    }

}